<script setup lang='ts'>
import echarts from 'vue-echarts'
import {ECOption} from '@/tool/echarts'
import http from '@/api/http'
const xAxisData = reactive([])
const seriesData = reactive([5, 20, 36, 10, 10, 20])
const echartsOption:ECOption = reactive({
    title: {
        text: '订单报表'
    },
    tooltip: {},
    xAxis: {
        data: xAxisData
    },
    yAxis: {},
    series: [
        {
            name: '销量',
            type: 'bar',
            data: seriesData
        }
    ]
})


const getMonthBirthday =()=>{
    http.get<any>('OrderDetail',{starMonth:2023}).then(res=>{
        console.log('res: ', res);
        xAxisData.length=0;
        seriesData.length =0;
        res.data.forEach(v => {
            xAxisData.push(v.monthNumber)
            seriesData.push(v.jg)
        });
       
        //echartsOption.series[0].type='pie'

    }).catch(err=>{
        console.log('err: ', err);

    })
}
onMounted(()=>{
    getMonthBirthday();
 
})




</script>

<template>
    <h3>会员报表</h3>
 
    
    <echarts id="main" :option="echartsOption"></echarts>
</template>


<style scoped>
#main {
  width: 600px;
  height: 400px;
}
</style>